package com.floorplanner.lib3ds.tracks
{
	import com.floorplanner.lib3ds.Lib3dsCore;
	import com.floorplanner.lib3ds.Lib3dsIO;
	
	public class Lib3dsTcb extends Lib3dsCore
	{
		public static const USE_TENSION:uint    = 0x0001;
		public static const USE_CONTINUITY:uint = 0x0002;
		public static const USE_BIAS:uint       = 0x0004;
		public static const USE_EASE_TO:uint    = 0x0008;
		public static const USE_EASE_FROM:uint  = 0x0010;	

		public var frame:int;	// int
		public var flags:int;	// short
		public var tens:Number;
		public var cont:Number;
		public var bias:Number;
		public var ease_to:Number;
		public var ease_from:Number;
		
		public function Lib3dsTcb( debugFlag:Boolean = true )
		{
			super( debugFlag );
			
			tens = cont = bias = ease_to = ease_from = 0;
		}
		
		/**
		 * 
		 */
		public function read( io:Lib3dsIO ):void
		{
			this.frame = io.readInt();
			this.flags = io.readWord();
			
			if( flags & USE_TENSION ) 
			{
				this.tens = io.readFloat();
			}
			else if( flags & USE_CONTINUITY )
			{
				this.cont = io.readFloat();
			}
			else if( flags & USE_BIAS )
			{
				this.bias = io.readFloat();
			}
			else if( flags & USE_EASE_TO )
			{
				this.ease_to = io.readFloat();
			}
			else if( flags & USE_EASE_FROM )
			{
				this.ease_from = io.readFloat();
			}
		}
	}
}
